import request from './index'

// 获取用户通知列表
export function getUserNotifications(params = {}) {
  return request({
    url: '/notifications',
    method: 'get',
    params: {
      page: 1,
      limit: 20,
      ...params
    }
  })
}

// 获取未读通知数量
export function getUnreadNotificationCount() {
  return request({
    url: '/notifications/unread-count',
    method: 'get'
  })
}

// 标记通知为已读
export function markNotificationAsRead(notificationId) {
  return request({
    url: `/notifications/${notificationId}/read`,
    method: 'put'
  })
}

// 标记所有通知为已读
export function markAllNotificationsAsRead() {
  return request({
    url: '/notifications/mark-all-read',
    method: 'put'
  })
}

// 删除通知
export function deleteNotification(notificationId) {
  return request({
    url: `/notifications/${notificationId}`,
    method: 'delete'
  })
}

// 删除所有通知
export function deleteAllNotifications() {
  return request({
    url: '/notifications/delete-all',
    method: 'delete'
  })
}

// 获取通知设置
export function getNotificationSettings() {
  return request({
    url: '/notifications/settings',
    method: 'get'
  })
}

// 更新通知设置
export function updateNotificationSettings(data) {
  return request({
    url: '/notifications/settings',
    method: 'put',
    data
  })
}

// 发送通知（系统管理员使用）
export function sendNotification(data) {
  return request({
    url: '/notifications/send',
    method: 'post',
    data
  })
}